'''
Created on Oct 26, 2012

@author: Zhao, Qi
'''

from includes import web
from common import config

def get_post_body():
    return web.data()

def get_server_key():
    return web.ctx.env.get('HTTP_' + config.HTTP_HEAD_PARAM_NAME, None) or web.cookies().get(config.HTTP_HEAD_PARAM_NAME, None)

def get_device_model():
    return web.ctx.env.get('HTTP_DEVICEMODEL')

def get_client_version():
    return web.ctx.env.get('HTTP_CLIENTVERSION','x.x.x')

def get_android_sdk_version():
    return web.ctx.env.get('HTTP_SDKVERSION')

def get_remote_addr():
    return web.ctx.env.get('REMOTE_ADDR')

def get_request_method():
    return web.ctx.env.get('REQUEST_METHOD')

def get_path_info():
    return web.ctx.env.get('PATH_INFO') 

def get_http_secondsfromgmt():
    return web.ctx.env.get('HTTP_SECONDSFROMGMT', None)

def get_http_geo_location():
    return web.ctx.env.get('HTTP_GEOLOCATION', None)

def get_query_string():
    return web.ctx.env['QUERY_STRING']

def get_path():
    return web.ctx.path.lstrip('/').lower()